// Copy Relative Values - Version 1.1

// This Script copies the relative values from the 2nd set of popups into the 1st set of popups.
// By adjusting the scale factor, you can simulate motion parallax.
// change the scale factor to numbers smaller than 1 for layer 1 behind layer 2.
// Change the scale factor to numbers greater than 1 for layer 1 in front of layer 2.

//      LAYER                                               PROPERTY                     CHANNEL
//      ------                                              ----------                     --------
// 1: Layer being affected                          property affected           channel affected
// 2: Layer to copy relative values from    property copying from    channel copying from

if (time() == start_time) { // Initialization

	scale_factor = 1.0;		// > 1 means scale up, < 1 means scale down

	// Compute the initial values for layer 1 and 2
	start_val1 = value(pop_layer(1), pop_property(1))[pop_channel(1)];
	start_val2 = value(pop_layer(2), pop_property(2))[pop_channel(2)];

} else {															// For every frame after the first
  
	// Calculate the current value for layer 2
	current_val2 = value(pop_layer(2), pop_property(2)) [pop_channel(2)];

	// Assign scaled values from layer 2 to layer 1.
	value(pop_layer(1), pop_property(1)) [pop_channel(1)] =
		start_val1 + (current_val2 - start_val2) * scale_factor;
}